//
//  DemoViewController.swift
//  JLRouter_Example
//
//  Created by Jiang Chencheng on 2024/8/19.
//  Copyright © 2024 CocoaPods. All rights reserved.
//

import UIKit
import JLUIKit
import JLRouter

class DemoViewController: JLViewController {

    lazy var btn = UIButton()
        .x
        .setTitle("back", for: .normal)
        .setTitleColor(.black, for: .normal)
        .addTarget(self, action: #selector(back), for: .touchUpInside)
        .instance
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        btn.x.add(to: view).snp.makeConstraints {
            $0.center.equalToSuperview()
        }
    }
    
    @objc
    func back() {
        JLRouter.back()
    }

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}

extension DemoViewController: JLRoutable {
 
    static let routePattern = "demo"
    
    
    static func initialize(values : [String : Any]) -> JLRoutable? {
        let vc = DemoViewController()
        vc.title = values["title"] as? String
        return vc
    }
    
}
